package com.wlz.thread;

import com.wlz.manager.AsyncManager;
import com.wlz.manager.factory.AsyncFactory;
import com.wlz.utils.SpringUtils;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author： wlz
 * @Date 2020/9/28 10:49
 * @description： TODO
 * @version: 1.0
 */
public class ThreadPoolTest {

    ThreadPoolTaskExecutor taskExecutor = SpringUtils.getBean("threadPoolTaskExecutor");

    /**
     *   异步添加登录日志
     */
    public void test1() {
        AsyncManager.me().execute(AsyncFactory.recordLogininfor("username", "0", "message"));
    }

    public void test2() {
        // 调用线程池
        taskExecutor.execute(new DemoThread(1));
    }

}
